1. Field of the Invention
The present invention is directed to managing locks and transactions.
2. Description of the Related Art
Oftentimes, resources (e.g., memory, disk drives, fiber optic channels, etc.) are shared among several applications. For example, several client computers, each running client applications, may access the same server computer with a set of resources. In certain cases, an application may want to access a resource without allowing any other applications to access the resource simultaneously. For example, if a first application wants to update data in a database, the first application may want access to the database to perform the update without other applications potentially attempting to update the same portion of the database.
To ensure serial access to resources, oftentimes locks are used. An application obtains a lock on a resource in order to obtain access to the resource. For example, if a first application obtained a lock on a first resource, a second application would not be able to access the first resource until the lock on the first resource was released by the first application.
In some cases, a request from a client application at a client computer may be sent to a first agent at a server computer. The first agent may pass the request to a second agent, which again may pass the request to a third agent. The first agent is acting as a client to the second agent, and the second agent is acting as a client to the third agent. The third agent may process the request (e.g., retrieve data) and return a result to the second agent, which returns the result to the first agent. The first agent then returns the result to the client application. Although three agents were used in this example, two or more agents working together to pass requests and return results may be referred to as cascading agents.
In some cases, each agent in the set of cascading agents obtains a lock on a resource. However, there is no link indicating the client application for which an agent obtained the lock. Thus, it is possible that a first agent obtains a lock on a resource for a client application. Then, when a second agent receives the request from the first agent and attempts to obtain a lock on the resource, the second agent is denied the lock. Since both the first and second agents are processing the same request for the client application, both should be able to lock the resource. Thus, some conventional systems do not support locking for cascading agents.
Multiple locks may be required to process a request. Some conventional systems require a client application to obtain all locks required to process a request. For example, if a first application requires access to a first and second resource, some systems require that the first application obtain locks for both resources before any processing. If the first application obtains a lock on the first resource, but a second application obtains a lock on the second resource, the first resource waits for the lock on the second resource.
Some systems require client applications to manage locks. The rules for locking may be onerous, which leads to increased complexity in the client applications.
Furthermore, some database management systems include transaction managers. These transaction managers log results of actions, without logging the actions.
There is a need in the art for an improved locking and transaction management system.